﻿using Gaf;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace LiteGafDemo.LiteAddins
{
    [Addin(@"IncludeEvent", 10)]
    public class IncludeEventActivator
    {
        /// <summary>
        /// 应用启动
        /// </summary>
        /// <param name="context"></param>
        public void Start(IServiceProvider provider)
        {
        }

        public void Configure(IConfiguration configuration, IServiceCollection services)
        {
           // throw new NotImplementedException();
        }

        static void OnAddinStateChanged(int addinId, string addinName, int addinState)
        {
            if (addinName == "IncludeEvent")
            {
                Console.WriteLine($"{addinId} [{addinName}] {addinState}");
            }
        }

        void OnFrameworkStateChanged(int frameworkState)
        {
            if (frameworkState == 8)
            {
                Console.WriteLine($"Gaf 已启动");
            }
        }

        static void OnFrameworkErrorOccurred(Exception ex)
        {
            Console.WriteLine(ex);
        }
    }
}
